package com.wc.alorithm_luogu.P2249;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @Author congge
 * @Date 2023/11/10 13:07
 * @description 查找
 * https://www.luogu.com.cn/problem/P2249
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] array = new int[n];
        int searchNum;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        Main main = new Main();
        StringBuffer ans = new StringBuffer();
        searchNum = sc.nextInt();
        ans.append(main.search(searchNum, array) + 1);
        for (int i = 1; i < m; i++) {
            searchNum = sc.nextInt();
            ans.append(' ');
            ans.append(main.search(searchNum, array) + 1);
        }

        System.out.println(ans);
    }

    public int search(int val, int[] array) {
        int left = 0;
        int right = array.length - 1;
        int mid;
        while (left <= right) {
            mid = left + (right - left) / 2;
            if (array[mid] == val) {
                if (left >= 0 && left < array.length && array[left] == val) {
                    return left;
                } else {
                    left++;
                }
                right = mid;
            } else if (array[mid] > val) {
                right = mid - 1;
            } else {
                left = mid + 1;
            }
        }
        return -2;
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
